<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://"
    + request.getServerName() + ":" + request.getServerPort()
    + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    <%@include file="../include/head.jsp" %>
    <%@include file="../include/link.jsp" %>
    <link rel="stylesheet" type="text/css" href="../../../static/wxApp/css/publist.css">
    <link rel="stylesheet" type="text/css" href="../../../static/wxApp/css/mobile_publish.css">
</head>
<body>
<%@include file="../include/appHerder.jsp" %>
<div class="container">
    <div class="content">
        <div class="apply"><h2>发布小程序</h2>
            <form class="form" method="post" action="#" id="publishForm"  novalidate="novalidate">
                <ul class="field">
                    <li>
                        <label for="appName">小程序名称（须与微信中名称一致）</label>
                        <input id="appName" type="text" name="appName" placeholder="请填写小程序名称" value="${app.appName}" />
                        <input type="hidden" name="id" value="${app.id}" />
                        <input type="hidden" name="sourceId" value="3" />
                    </li>
                    <li>
                        <label for="">小程序分类</label>
                        <select name="category" id="category">
                            <option value="">- 请选择 -</option>
                            <option <c:if test="${app.category==1}">selected</c:if> value="1">新闻资讯</option>
                            <option <c:if test="${app.category==2}">selected</c:if> value="2">影音直播</option>
                            <option <c:if test="${app.category==3}">selected</c:if> value="3">娱乐搞笑</option>
                            <option <c:if test="${app.category==4}">selected</c:if> value="4">体育运动</option>
                            <option <c:if test="${app.category==5}">selected</c:if> value="5">旅游出行</option>
                            <option <c:if test="${app.category==6}">selected</c:if> value="6">电商购物</option>
                            <option <c:if test="${app.category==7}">selected</c:if> value="7">金融理财</option>
                            <option <c:if test="${app.category==8}">selected</c:if> value="8">摄影图片</option>
                            <option <c:if test="${app.category==9}">selected</c:if> value="9">实用工具</option>
                            <option <c:if test="${app.category==10}">selected</c:if> value="10">图书阅读</option>
                            <option <c:if test="${app.category==11}">selected</c:if> value="11">教育学习</option>
                            <option <c:if test="${app.category==12}">selected</c:if> value="12">居家生活</option>
                            <option <c:if test="${app.category==13}">selected</c:if> value="13">医疗健康</option>
                            <option <c:if test="${app.category==14}">selected</c:if> value="14">商务办公</option>
                            <option <c:if test="${app.category==15}">selected</c:if> value="15">社交通讯</option>
                            <option <c:if test="${app.category==16}">selected</c:if> value="16">餐饮美食</option>
                            <option <c:if test="${app.category==17}">selected</c:if> value="17">美妆美颜</option>
                            <option <c:if test="${app.category==18}">selected</c:if> value="18">汽车交通</option>
                            <option <c:if test="${app.category==19}">selected</c:if> value="19">房地产</option>
                        </select>
                    </li>
                    <li>
                        <label for="tagsArr">小程序标签（多个以英文逗号分隔，如：工具,效率,办公）</label>
                        <input type="text" name="tagsArr" id="tagsArr" placeholder="请填写小程序标签" value="${app.tagsArr}">
                    </li>
                    <li>
                        <label for="qq">联系QQ（方便我们与您取得联系）</label>
                        <input type="text" id="qq" name="qq" value="${app.qq}" placeholder="请填写QQ号">
                    </li>
                    <li class="clearfix">
                        <label for="">小程序图标 &amp; 二维码（推荐尺寸: 500x500）</label>
                                <div class="clearfix">
                                    <div class="file-item" style="position: relative;">
                                        <div class="file " id="avatar" style="z-index: 1;">
                                            <span class="add">+</span>
                                            <img class="preview" src="${imgServer}${app.logoUrl}" <c:if test="${not empty app.logoUrl}">style="display: block" </c:if> width="120" alt="">
                                            <input class="fileurl" type="hidden" name="logoUrl" id="logoUrl" value="${app.logoUrl}">
                                            <span class="del">更换</span>
                                            <input type="file" name="file" class="upload" id="upload1">
                                        </div>
                                        <label for="">小程序图标</label><label for="avatar" class="avatar-error error"></label>
                                    </div>
                                    <div class="file-item" style="position: relative;">
                                <div class="file " id="qrimg" style="z-index: 1;">
                                    <span class="add">+</span>
                                    <img class="preview" src="${imgServer}${app.qrUrl}" <c:if test="${not empty app.qrUrl}">style="display: block" </c:if> width="120" alt="" >
                                    <input class="fileurl" type="hidden" name="qrUrl" id="qrUrl" value="${app.qrUrl}">
                                    <span lass="del">更换</span>
                                    <input type="file" name="file" class="upload" id="upload2">
                                </div>
                                <label for="">小程序二维码</label><label for="qrimg" class="qrimg-error error"></label>
                            </div>
                        </div>
                    </li>
                    <li>
                      <label for="qq">小程序用途（一句话简要概括小程序的用途，不少于10字！）</label>
                      <textarea name="appSum" placeholder="XXX小程序是一款XXX的小程序"  minlength="10" >${app.appSum}</textarea>
                    </li>
                    <li>
                      <label for="">小程序简介</label>
                      <input name="appDesc" type="hidden" id="appDesc">
                        <!-- 加载编辑器的容器 -->
                        <c:choose>
                          <c:when test="${not empty app and not empty app.appDesc}">
                            <script id="container" name="content" type="text/plain">
                              ${app.appDesc}
                            </script>
                          </c:when>
                          <c:otherwise>
                            <script id="container" name="content" type="text/plain">
                              <strong>描述小程序的详细功能及用途，描述的越详细，越有可能被推荐到首页哦~</strong>
                            </script>
                          </c:otherwise>
                        </c:choose>
                    </li>
                    <li>
                        <label for="">小程序截图（推荐尺寸: 1334x750, 建议至少上传三张）</label>
                        <label for="check-screenshot"  class="check-screenshot-error error"></label>
                        <div class="clearfix">
                            <div class="screenshot-list clearfix">
                                <c:forEach items="${app.scrUrlsArr}" var="crUrl">
                                    <div class="file uploaded screenshot-item">
                                        <img style="display:block" class="preview" src="${imgServer}${crUrl}" width="120" alt="">
                                        <input class="fileurl" type="hidden" name="scrUrlsArr" value="${crUrl}">
                                        <span class="del">删除</span>
                                    </div>
                                </c:forEach>
                            </div>
                            <div class="add-screenshot" style="display: block; position: relative;">
                                <div class="file" id="images" style="z-index: 1;">
                                    <span class="add">+</span>
                                    <img  class="" src="#" width="150" alt="">
                                </div>
                                <input type="file" name="file" class="upload" id="multiUpload">
                            </div>
                        </div>
                    </li>
                    <li class="btn-group clearfix">
                        <c:choose>
                            <c:when test="${not empty user and user=='admin'}">
                                <input type="hidden" name="isCheck" value="1">
                                <button class="submit">审核</button>
                            </c:when>
                            <c:otherwise>
                                <input type="hidden" name="isCheck" value="0">
                                <button class="submit">提交</button>
                            </c:otherwise>
                        </c:choose>
                        <a class="cancel" href="/">取消</a><label for="" class="form-all-error" style="display:none">标红项填写有误</label>
                    </li>
                </ul>
            </form>
        </div>
    </div>
</div>
<input type="hidden" id="imgServer" value="${imgServer}">
<%@include file="../include/footer.jsp" %>
</body>
<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script>
<script src="../../../static/common/js/ajaxfileupload.js"></script>
<script src="../../../static/wxApp/js/publish.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="../../../ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="../../../ueditor/ueditor.all.js"></script>
<!-- 语言包文件(建议手动加载语言包，避免在ie下，因为加载语言失败导致编辑器加载失败) -->
<script type="text/javascript" src="../../../ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
  $("#container").css("margin-top","12px");
</script>
</html>
